<template>
<div class="sub-div">
  <span>父组件传递给子组件的值是：{{ car }}</span>
  <br/>
  <span>子组件的值是：{{ toy }}</span>
  <br/>
  <button @click="sendToy1">传递玩具</button>
</div>

</template>
<script setup lang="ts">
import { defineOptions, ref} from 'vue'
import { defineProps } from 'vue'

defineOptions({
  name: 'TongXin1Child'
})

const props = defineProps<{
  car: string,
  sendToy: (value: string) => void
}>()

const toy = ref('遥控飞机')

const sendToy1 = () => {
  props.sendToy(toy.value)
}


</script>
<style lang="scss" scoped>
.sub-div {
  margin-top: 30px;
  padding: 10px 10px;
  color: #42b983;
  font-weight: bold;
  background-color: rgb(15, 105, 184);
}

</style>
